﻿using System;
using System.ComponentModel;
using Aierp.Utility;
using Chloe.Entity;

namespace Aierp.SystemEntities.System
{
    [Description("系统用户")]
    public class Sys_Users
    {
        [Column(IsPrimaryKey = true)]
        [AutoIncrement]
        public int KeyId { get; set; }
        [Description("用户名")]
        public string UserName { get; set; }
        [Description("密码")]
        public string Password { get; set; }
        [Description("真实姓名")]
        public string TrueName { get; set; }
        [Description("密码佐料")]
        public string PassSalt { get; set; }

        public string Email { get; set; }
        [Description("是否超管")]
        public bool IsAdmin { get; set; }
        [Description("是否禁用")]
        public bool IsDisabled { get; set; }
        [Description("部门Id")]
        public int DepartmentId { get; set; }
        [Description("手机")]
        public string Mobile { get; set; }

        public string QQ { get; set; }
        [Description("备注")]
        public string Remark { get; set; }
        [Description("个性化设置")]
        public string ConfigJson { get; set; }

        [Description("添加时间")]
        public DateTime? AddTime { get; set; }
        
        //[DbField(false)]
        //public Department Department
        //{
        //    get { return DepartmentDal.Instance.Get(DepartmentId); }
        //}

        //[DbField(false)]
        ////public List<Sys_Navigations> Navigations { get; set; }

        //[DbField(false)]
        //public IEnumerable<Role> Roles
        //{
        //    get { return UserDal.Instance.GetRolesBy(KeyId); }
        //}

        /// <summary>
        /// 用户可以访问的部门列表
        /// </summary>
        //[DbField(false)]
        //public string Departments
        //{
        //    get { return string.Join(",", UserDal.Instance.GetDepIDs(KeyId)); }
        //}


        public override string ToString()
        {
            return JSONhelper.ToJson(this);
        }

    }

    //public class Sys_Users : User { }
}
